package io.github.uicdb.et.item.weapon;

import io.github.uicdb.et.item_data.ItemElementData;
import io.github.uicdb.et.ModItemDataComponents;
import io.github.uicdb.et.element.BasicElement;
import net.minecraft.core.Holder;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.UseAnim;
import net.minecraft.world.level.Level;

public class StaffItem extends Item {
    public StaffItem(Properties properties, Holder<BasicElement> elementHolder, int amount, int ticks, int durability) {
        super(properties.component(ModItemDataComponents.ITEM_ELEMENT_DATA, new ItemElementData(
                elementHolder, amount, ticks
        )).durability(
                durability
        ));
    }

    @Override
    public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand usedHand) {
        player.startUsingItem(usedHand);
        return super.use(level, player, usedHand);
    }


    @Override
    public UseAnim getUseAnimation(ItemStack stack) {
        return UseAnim.SPEAR;
    }

}
